<?

include_once("../../config.inc.php");	

include_once ("../../class/mysqldb.inc.php");

$db=new mysqldb();

$id = $_GET['id'];

if(empty($id)){

	$id = 0;

}

$act = $_GET['act'];

$TypeName = $_GET['TypeName'];

$TypeName = trim($TypeName);

if($act=="edit"){

	$sql="update hy_b_paytype set TypeName = '".$TypeName."' where ID = ".$id;

	$rs=mysql_query($sql);

}else if($act=="del"){

	$sql="delete from hy_b_paytype where ID=".$id;

	$rs=mysql_query($sql);

}else if($act=="add"){

	$sql="insert into hy_b_paytype (TypeName)values('".$TypeName."')";

	//echo $sql; exit;

	$rs=mysql_query($sql);

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Administrator's Control Panel</title>

<link href="../css/style.css" rel="stylesheet" type="text/css" />

<script language="JavaScript">

<!--

function update(id,w){

	name = document.getElementById("TypeName"+id).value;

	location.href="?act=edit&id="+id+"&TypeName="+name;

}

function add(){

	name = document.getElementById("addName").value;

	location.href="?act=add&TypeName="+name;

}

function del(w)

{	

	if(confirm("真的要删除吗？"))

		{	

		

		location.href="?act=del&id="+w

			return true

		}

}

function mOvr(src,clrOver)

{	

   if (!src.contains(event.fromElement))

	{	 src.bgColor = clrOver;

	}

}

function mOut(src,clrIn)

{	if (!src.contains(event.toElement))

	{	src.bgColor = clrIn;

	}

}

//-->

</script>

</head>

<body id="main" >

<?

$sql="SELECT * FROM `hy_b_paytype`";

$rs=mysql_query($sql);

?>

<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">

  <tr>

    <td><h1>付费方式 </h1></td>

    <td width="100"><a href="pay_for_add.php">新增</a></td>

  </tr>

</table> 

	<table cellspacing="0" cellpadding="0" width="100%"  class="listtable">

    <tr> 

      <th width="12%">ID</th>

      <th width="23%">付费方式</th>

      <th width="43%">描述</th>

      <th width="9%">修改</th>

      <th width="10%">删除</th>

    </tr>

<?php

if (mysql_num_rows($rs)==0)	echo "<tr align='center'><td colspan='5'><font color=red>没有付费方式!</font></td></tr></table>" ;

		while ($rss=mysql_fetch_array($rs))

		{

		?>

				<tr>

					<td><? echo $rss['ID'];?></td>

					<td><? echo $rss["TypeName"];?></td>

                    <td><? echo $rss["Content"];?></td>

					<td><a href="pay_for_add.php?id=<?=$rss['ID']?>" >修改</a></td>

					<td><a href="javascript:del(<?=$rss['ID']?>)">删除</a></td>

				</tr>

		<?php

}

?>

	</table>

<?php include "../bottom.php"; ?>

</body>

</html>

